package com.gn.compile;


import org.springframework.boot.autoconfigure.couchbase.CouchbaseProperties;

import java.io.*;


public class ErrorReader
{
    private static FileReader fileReader;
    private static LineNumberReader reader;

    static
    {
        File file = new File("../../../错误提示.txt");//文件路径
        try
        {
            fileReader = new FileReader(file);
            reader = new LineNumberReader(fileReader);
            reader.mark(999999);
        } catch (IOException e)
        {
            e.printStackTrace();
        }
    }

    public static String getErrorReminder(int row)
    {
        String reminder = "";
        try
        {
            reader.reset();
            int line = 0;
            while (line < row-1)
            {
                reader.readLine();
                line++;
            }
            reminder = reader.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        return reminder;
    }


    public static void close()
    {
        try
        {
            reader.close();
            fileReader.close();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
    }

    public static void main(String[] args)
    {
        System.out.println(getErrorReminder(5));
        System.out.println(getErrorReminder(10));
        System.out.println(getErrorReminder(30));

        close();
    }
}
